package org.particlethink.response;

import io.swagger.v3.oas.annotations.media.Schema;
import org.particlethink.entry.PlanStatus;
import org.particlethink.handler.PlanStatusHandler;
import org.particlethink.model.*;
import tk.mybatis.mapper.annotation.ColumnType;

import javax.persistence.Id;
import java.util.Date;
import java.util.List;

public class BatchPlanResponse {
    private int id;
    @Schema(description = "批次计划单号")
    private String no;
    @Schema(description = "项目")
    private ProjectResponse project;
    @Schema(description = "物料大类")
    private CategoryResponse category;
    @Schema(description = "总计划id")
    private int masterPlanId;//总计划id
    @Schema(description = "总计划单号")
    private String masterPlanNo;//总计划id
    @Schema(description = "最晚进场时间")
    private Date deadlineAt;//最晚进场时间
    @Schema(description = "状态 int 1:待提交；2：已提交；3：已作废")
    private PlanStatus status;
    @Schema(description = "提交人")
    private ProjectUserResponse submitUser;//提交人
    @Schema(description = "提交时间")
    private Date submitAt;//提交时间
    @Schema(description = "创建人")
    private ProjectUserResponse createUser;//创建人
    @Schema(description = "创建时间")
    private Date createdAt;

    @Schema(description = "备注")
    private String remark;//备注
    @Schema(description = "附件")
    private AttachmentResponse attachment;//附件
    @Schema(description = "规划数量")
    private int expectNum;//规划数量(一个物料大类的总和)
    @Schema(description = "单位")
    private String unit;//单位

    public BatchPlanResponse() {
    }


    public BatchPlanResponse(
            BatchPlan batchPlan,
            Project project,
            Category category,
            ProjectUser submitUser,
            ProjectUser createUser
    ) {


        this.id = batchPlan.getId();
        this.project = new ProjectResponse(project);
        this.category = new CategoryResponse(category);
        this.masterPlanId = batchPlan.getMasterPlanId();
        this.deadlineAt = batchPlan.getDeadlineAt();
        this.status = batchPlan.getStatus();
        if (submitUser != null) {
            this.submitUser = new ProjectUserResponse(submitUser);
        }
        this.submitAt = batchPlan.getSubmitAt();
        if (createUser != null) {
            this.createUser = new ProjectUserResponse(createUser);
        }
        this.createdAt = batchPlan.getCreatedAt();
        this.remark = batchPlan.getRemark();
        this.attachment = new AttachmentResponse(batchPlan.getAttachmentName(), batchPlan.getAttachment());
        this.expectNum = batchPlan.getExpectNum();
        this.unit = batchPlan.getUnit();
        this.no = batchPlan.getNo();
        this.masterPlanNo = batchPlan.getMasterPlanNo();
    }


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


    public ProjectResponse getProject() {
        return project;
    }

    public void setProject(ProjectResponse project) {
        this.project = project;
    }

    public CategoryResponse getCategory() {
        return category;
    }

    public void setCategory(CategoryResponse category) {
        this.category = category;
    }

    public int getMasterPlanId() {
        return masterPlanId;
    }

    public void setMasterPlanId(int masterPlanId) {
        this.masterPlanId = masterPlanId;
    }

    public Date getDeadlineAt() {
        return deadlineAt;
    }

    public void setDeadlineAt(Date deadlineAt) {
        this.deadlineAt = deadlineAt;
    }

    public PlanStatus getStatus() {
        return status;
    }

    public void setStatus(PlanStatus status) {
        this.status = status;
    }

    public ProjectUserResponse getSubmitUser() {
        return submitUser;
    }

    public void setSubmitUser(ProjectUserResponse submitUser) {
        this.submitUser = submitUser;
    }

    public Date getSubmitAt() {
        return submitAt;
    }

    public void setSubmitAt(Date submitAt) {
        this.submitAt = submitAt;
    }

    public ProjectUserResponse getCreateUser() {
        return createUser;
    }

    public void setCreateUser(ProjectUserResponse createUser) {
        this.createUser = createUser;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }



    public int getExpectNum() {
        return expectNum;
    }

    public void setExpectNum(int expectNum) {
        this.expectNum = expectNum;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getMasterPlanNo() {
        return masterPlanNo;
    }

    public void setMasterPlanNo(String masterPlanNo) {
        this.masterPlanNo = masterPlanNo;
    }

    public AttachmentResponse getAttachment() {
        return attachment;
    }

    public void setAttachment(AttachmentResponse attachment) {
        this.attachment = attachment;
    }
}
